home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / HSBASIC2.DMS / in.adf / HB2Examples1.3.Lha / Examples / Tasks / ReadMe < prev    next >
Encoding:
Text File  |  1994-04-29  |  2.0 KB  |  39 lines

  1. SimpleTask.bas - Task creation and co-ordination from BASIC
  2. ===========================================================
  3.  
  4. Derived from RKM example (c) Copyright 1992 Commodore-Amiga, Inc.
  5.  
  6. This is a variant on the Commodore example "Task creation with Amiga.lib",
  7. taken from the Libraries RKM p.467.
  8.  
  9. The example shows how multi-tasking programs in BASIC are possible. It borrows
  10. the Hook idea to start the task (although Hooks were added as part of V36
  11. there is nothing about them which stops them being used on any vintage of the
  12. Amiga OS), the code for starting the task is a variant on the ExecSupport.bas
  13. CreateTask, named CreateHookEntryTask; this FUNCTION creates the necessary
  14. task structures and the hook for retrieving the BASIC runtime context in the
  15. context of the child task. The TaskHookEntry.s file is used to glue the task
  16. entry point to the BASIC hook entry point. Both these files are stored in the
  17. BH:BLib/ sub-directory.
  18.  
  19. Note that using tasks is _not_ for the faint hearted, you must be thinking at
  20. all times about what your are asking the compiler and its runtime system to
  21. do (since the code must be re-entrant). If you try something like PRINT for
  22. example in the sub-task the machine will crash horribly with no indication of
  23. what went wrong - what went wrong is PRINT uses DOS, which a task cannot call,
  24. even if we were using a process (which can call DOS) the machine would still
  25. most likely crash as PRINT is a complex involved BASIC statement which is
  26. almost certainly not re-entrant.
  27.  
  28. The example will work on all non-obsolete versions of Workbench (V33 and
  29. above).
  30.  
  31. Compiling
  32. ---------
  33. Load the SimpleTask_inc.bh file and Tokenise it (Program-Tokenise), making
  34. sure you have no token file selected in the File Options (Settings-Compiler-
  35. Files). Once you have your token file, set the File Options-Token File setting
  36. to the SimpleTask_inc.t file just created. Load the SimpleTask.bas file then
  37. compile & run it. Note that the TaskHookEntry.s file is effectively embedded
  38. in the task creation routines.
  39.